# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=o-saft
pkgver=7166.0895abb7
pkgrel=1
groups=('blackarch' 'blackarch-scanner' 'blackarch-recon')
pkgdesc='A tool to show informations about SSL certificate and tests the SSL connection according given list of ciphers and various SSL configurations.'
arch=('any')
url='https://www.owasp.org/index.php/O-Saft'
license=('GPL2')
depends=('perl' 'perl-io-socket-ssl' 'perl-net-ssleay' 'perl-io-socket-inet6')
makedepends=('git')
source=("$pkgname::git+https://github.com/OWASP/O-Saft.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md CHANGES
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md CHANGES LICENSE.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec perl /usr/share/$pkgname/$pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

